package com.example.ovulationperiodtracker.Allactivity;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.afollestad.materialdialogs.MaterialDialog;
import com.example.ovulationperiodtracker.R;
import com.example.ovulationperiodtracker.databinding.ActivityJingLengthBinding;
import com.example.ovulationperiodtracker.model.Settings;
import com.example.ovulationperiodtracker.utils.JCGSQLiteHelper;
import com.example.ovulationperiodtracker.view.NavigationView;
import com.example.ovulationperiodtracker.view.NoteUtils;
import com.necer.base.BaseActivity;
import com.shawnlin.numberpicker.NumberPicker;
import com.tencent.mmkv.MMKV;

public class JingLengthActivity extends BaseActivity<ActivityJingLengthBinding> {

    @Override
    protected ActivityJingLengthBinding createBinding(LayoutInflater inflater) {
        return ActivityJingLengthBinding.inflate(inflater);
    }

    @Override
    protected void onCreated(Bundle savedInstanceState) {

        binding.navigation.setOnClickRightListener(new NavigationView.OnClickRightListener() {
            @Override
            public void onClickRight() {
                save();
            }
        });

        int jingLength = NoteUtils.getJingLength();
        if (jingLength != 0) {
            binding.numberPicker.setValue(jingLength);
        }

    }


    private void save() {
        int value = binding.numberPicker.getValue();
        NoteUtils.saveJingLength(value);
        finish();
    }


}
